package com.easemob.chat;

import com.easemob.util.EMLog;
import java.util.List;

@Deprecated
public class EMCmdManager
{
  private static final String TAG = "cmdmgr";
  private static EMCmdManager instance = null;
  List<CmdMsgProcessor> cmdProcessors = null;

  private EMCmdManager()
  {
    addCmdProcessor(new SwipeCmdProcessor());
  }

  public static EMCmdManager getInstance()
  {
    if (instance == null)
      instance = new EMCmdManager();
    return instance;
  }

  public void addCmdProcessor(CmdMsgProcessor paramCmdMsgProcessor)
  {
    EMLog.d("cmdmgr", "add cmd processor for action:" + paramCmdMsgProcessor.getAction() + " cls:" + paramCmdMsgProcessor.getClass().getName());
    this.cmdProcessors.add(paramCmdMsgProcessor);
  }

  public void processCmd(EMMessage paramEMMessage)
  {
    CmdMessageBody localCmdMessageBody = (CmdMessageBody)paramEMMessage.body;
    EMLog.d("cmdmgr", "process cmd msg. action:" + localCmdMessageBody.action + " params:" + localCmdMessageBody.params);
    for (int i = 0; i < this.cmdProcessors.size(); i++)
    {
      CmdMsgProcessor localCmdMsgProcessor = (CmdMsgProcessor)this.cmdProcessors.get(i);
      if (localCmdMsgProcessor.getAction().equals(localCmdMessageBody.action))
      {
        EMLog.d("cmdmgr", "process cmd action:" + localCmdMessageBody.action + " with processor:" + localCmdMsgProcessor.getClass().getName());
        try
        {
          if (localCmdMsgProcessor.processCmd(paramEMMessage))
            EMLog.d("cmdmgr", "process cmd return true. stop");
        }
        catch (Throwable localThrowable)
        {
          localThrowable.printStackTrace();
        }
      }
    }
  }
}

/* Location:           D:\hygieia\userclient\common\libs\easemobchat_2.1.8.jar
 * Qualified Name:     com.easemob.chat.EMCmdManager
 * JD-Core Version:    0.6.1
 */